import axios from 'axios'
// 设置基准路径
axios.defaults.baseURL = 'http://localhost:8888/api'
// 新闻列表页
export const getNewsList = () => axios.get('/getnewslist').then(res => res.data)
// 新闻详情页
export const getNewsDetail = (id) => axios.get(`/getnew/${id}`).then(res => res.data)
// 评论列表
export const getCommentList = (id, pageindex) => axios.get(`/getcomments/${id}`, { params: { pageindex } }).then(res => res.data)
// 发表评论
export const newsPost = (id, content) => axios.post(`/postcomment/${id}`, content).then(res => res.data)
// 图片列表页
export const getImgsList = (id) => axios.get(`/getimages/${id}`).then(res => res.data)
// 获取图片列表顶部分类
export const getTopCate = () => axios.get('getimgcategory').then(res => res.data)
// 获取图文详情
export const getImgDetail = (id) => axios.get(`/getthumimages/${id}`).then(res => res.data)
// 获取缩略图描述
export const getImageInfo = (id) => axios.get(`/getimageInfo/${id}`).then(res => res.data)
// 获取商品列表
export const getGoodsList = (pageindex) => axios.get('/getgoods', { params: { pageindex } }).then(res => res.data)
// 获取商品详情
export const getGoodsDesc = (id) => axios.get(`/goods/getinfo/${id}`).then(res => res.data)
// 图文介绍
export const getDesc = (id) => axios.get(`/goods/getdesc/${id}`).then(res => res.data)
// 获取购物车数据
export const getCartDate = (id) => axios.get(`/goods/getshopcarlist/${id}`).then(res => res.data)
